using DiLu.Expansion.DataStorage.Common.BaseModels;
using DiLu.Expansion.DataStorage.Common.ColumnDataConverts;
using DiLu.Expansion.DataStorage.Common.Columns;
using SqlSugar;

namespace TestWeb.Models;

[Tenant("master")]
[SplitTable(SplitType.Month)]
[SugarTable("tb_TestLog_{year}{month}{day}")]
public class TestLog : UlidModel<bool, TestLog>, IHasPrimaryKey<Ulid, TestLog>
{
    /// <summary>
    ///     Name
    /// </summary>
    [SugarColumn(ColumnDescription = "测试名称")]
    public string Name { get; set; }

    /// <summary>
    ///     Id
    /// </summary>
    [SugarColumn(IsPrimaryKey = true, Length = 26, SqlParameterDbType = typeof(UlidConvert))]
    public Ulid Id { get; set; }

    public TestLog GeneratePrimaryKey()
    {
        Id = Ulid.NewUlid();
        return this;
    }

    public TestLog SetName(string name)
    {
        Name = name;
        return this;
    }
}